var inp1=document.querySelector("[name=username]");
inp1.onfocus=function(){
	this.style.color="#333";
	this.style.border="1px solid #909090";
}
inp1.onblur=function(){
	if(this.value==""){
		this.style.border="1px solid red";
	}
}

var inp2=document.querySelector("[name=email]");
inp2.onfocus=function(){
	this.style.color="#333";
	this.style.border="1px solid #909090";
}
inp2.onblur=function(){
	if(this.value==""){
		this.style.border="1px solid red";
	}
	var reg=/^\d{6,}@\w+.\w+$/;
	if(reg.test(this.value)){
		this.style.color="#333";
		this.style.border="1px solid #909090";
	}else{
		this.style.border="1px solid red";
		this.style.color="red";
	}
}

var inp3=document.querySelector("[name=pwd]");
inp3.onfocus=function(){
	this.style.color="#333";
	this.style.border="1px solid #909090";
}
inp3.onblur=function(){
	if(this.value==""){
		this.style.border="1px solid red";
	}
	var reg=/^(?![0-9]+$)(?![a-zA-Z]+$)(?![!@#$%^&*()~?]+$)[a-zA-Z0-9!@#$%^&*()~?]{6,16}$/;
	if(reg.test(this.value)){
		this.style.color="#333";
		this.style.border="1px solid #909090";
	}else{
		this.style.border="1px solid red";
		this.style.color="red";
	}
}

var inps=document.getElementsByTagName("input");
var form=document.getElementsByTagName("form")[0];
form.onsubmit=function(){
	for(var i=0;i<inps.length-3;i++){
		inps[i].onblur();
		if(inps[i].style.color=="red"){
			return false;
		}
	}
}
inps[5].onclick=()=>{
	location="sign.html";
}





